package cn.one.ball.controller;

import cn.one.ball.entity.Banner;
import cn.one.ball.entity.Player;
import cn.one.ball.entity.Product;
import cn.one.ball.mapper.BannerMapper;
import cn.one.ball.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
@RequestMapping("/product/")
public class ProductController {
    @Autowired(required = false)
    ProductMapper mapper;
    @RequestMapping("select")
    public List<Product> select(){
        return mapper.select();
    }
    @RequestMapping("delete")
    public void deleteById(int id){
       mapper.deleteById(id);
    }
    @RequestMapping("insert")
    public void insert(@RequestBody Product product){
        System.out.println("player" + product);
        mapper.insert(product);
    }
    @RequestMapping("selectById")
    public Product selectById(int id){
        return mapper.selectById(id);
    }
}
